package cards;

public abstract class Card {
	private static int nextId=1;
	private int id;
	private CardType type;
	private int cost;
	
	public abstract boolean check();
	public abstract Card newInstance(CardType type);
	
	public int getId() {
		return id;
	}
	public CardType getType() {
		return type;
	}
	public int getCost() {
		return cost;
	}
	
	public static Card getCard(CardType type) {
		Card newcard = type.getTempalate().newInstance(type);
		newcard.type = type;
		newcard.cost = type.getCost();
		newcard.id = Card.nextId++;
		return newcard;
	}
	
	public String toString() {
		return "Card id="+id+" type: "+type.name()+" cost: "+cost;
	}
	
}
